/* Redirect.java
 * 
 * WalkIn - Team C
 * 
 * author: 	Sebastian Quandt
 * date:	08.06.2007
 * 
 * class Redirect
 */

package presentation.controller;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;

/**
 * class Redirect
 * 
 * controller for all request handling a redirect to an other page of the website
 * 
 * @date	08.06.2007
 * 
 */

public class Redirect extends HttpBaseController {
	
	/**
	 * method handling and analyse the request
	 */
	@Override
	public void process() {
		String target = null;
		if(m_Arguments != null)
			target = m_Arguments.get("target");
		
		target = "index.jsp";
		
		
		dispatchTo(target);
	}
	
	/**
	 * method handling the redirect to the overgiven page
	 *
	 */
	public void dispatchTo(String dispatchURL) {
		
		m_Request.setAttribute("rightWay", "true");

		try {
			RequestDispatcher dispatcher = m_ServletContext.getRequestDispatcher("/" + dispatchURL);
			dispatcher.forward(m_Request, m_Response);
		} catch (ServletException e) {
			// TODO Presentation Exception
		} catch (IOException e) {
			// TODO Presentation Exception
		}
	}
	
}//Redirect

/*end of Redirect.java*/

